package net.seehope.foodie.code;

import javax.imageio.ImageIO;

import org.springframework.stereotype.Component;
import org.springframework.web.context.request.ServletWebRequest;

@Component
public class ImageValidateCodeProcessor extends AbstractValidateCodeProcessor<ImaValidateCode>{

	@Override
	protected void send(ServletWebRequest request, ImaValidateCode validateCode) throws Exception {
		
		ImageIO.write(validateCode.getImage(),"JPEG", request.getResponse().getOutputStream());
	}

	@Override
	protected String getType(){
		return "image";
	}
	
}
